package com.brillilab.service.module.message.template.impl.method;

import com.alibaba.fastjson.JSONObject;
import com.brillilab.service.module.message.template.AbstractMessageTemplate;
import com.brillilab.service.module.message.template.enums.MessageTypeEnum;
import lombok.Data;

import java.util.Map;

/**
 * @author zlb
 * @Title: SingleRecommendMethodTemp
 * @ProjectName brill_lab
 * @Description: 收到管理员推荐的单条方法(无同三级类型)
 * @date 2019/5/27 19:07
 */
@Data
public class SingleRecommendMethodTemp extends AbstractMessageTemplate {
    private String PIName;
    private String methodName;
    private Long methodRecommendId;
    private Long methodRecommendAuditId;

    /**
     * 收到管理员推荐的单条方法
     *
     * @param labId       实验室ID
     * @param PIName      管理员姓名
     * @param methodName  方法名称
     * @param methodRecommendId     方法推荐Id
     * @param methodRecommendAuditId     方法推荐审核Id
     */
    public SingleRecommendMethodTemp(Long labId,Map<Long,Long> receivers,String PIName,String methodName,Long methodRecommendId,Long methodRecommendAuditId) {
        super(labId, 0L);
        super.setType(MessageTypeEnum.SingleRecommendMethod.getValue());
        super.setTitle("您收到了管理员推荐的方法");
        String content = String.format("<span>您收到</span><span style='color:#F6AC2D'>%s</span><span>推荐的</span>" +
                "<span style='color:#F6AC2D'>%s</span><span>方法</span>", PIName, methodName);
        super.setContent(content);
        super.setAppContent(String.format("您收到%s推荐的%s方法", PIName, methodName));
        super.setReceiverMap(receivers);
        this.PIName = PIName;
        this.methodName = methodName;
        this.methodRecommendId = methodRecommendId;
        this.methodRecommendAuditId = methodRecommendAuditId;
    }

    @Override
    public String getJsonData() {
        JSONObject object = new JSONObject();
        object.put("methodRecommendId", methodRecommendId);
        object.put("methodRecommendAuditId", methodRecommendAuditId);
        object.put("content",appContent);
        return object.toJSONString();
    }

}
